import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;


public class GameEngine extends BasicGame{
	
	private static final int SCREEN_WIDTH = 1000;
	private static final int SCREEN_HEIGHT = 800;
	private String gameState = "gameplay";
	
	
	private GamePlay gp = null;
	
	public GameEngine() {
		super("Bubble Run");
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) throws SlickException {
		AppGameContainer gameContainer = new AppGameContainer(new GameEngine());
		gameContainer.setDisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT, false);
		gameContainer.start();
	}

	@Override
	public void render(GameContainer gc, Graphics g) throws SlickException {
		if(gameState.equals("menu")){
			// TODO Render the menu
		}
		if(gameState.equals("gameplay")){
			gp.render(gc,g);
		}
		if(gameState.equals("tutorial")){
			// TODO Render the tutorial
		}
	}

	@Override
	public void init(GameContainer gc) throws SlickException {
		gp = new GamePlay();
	}

	@Override
	public void update(GameContainer gc, int delta ) throws SlickException {
		if(gameState.equals("menu")){
			// TODO update menu
		}
		if(gameState.equals("tutorial")){
			// TODO update tutorial
		}
		if(gameState.equals("gameplay")){
			gp.update(gc, delta);
		}
		
	}
	
	public void setGameState(String newGS){
		if(newGS.equals("menu")||newGS.equals("gameplay")||newGS.equals("tutorial")){
			this.gameState = newGS;
		}
	}
	
	public String getGameState(){
		return this.gameState;
	}
}

